* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    transform: translateY(-2px);
}

.btn-info {
    background-color: #17a2b8;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-info:hover {
    background-color: #138496;
}

/* Section styles */
section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.overview-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.card-title {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
}

/* Simulation Controls */
.simulation-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.simulation-result {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    min-height: 60px;
    display: none;
}

.simulation-result.show {
    display: block;
}

.simulation-result.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.simulation-result.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.fingerprints-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.fingerprints-table th,
.fingerprints-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.fingerprints-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.fingerprints-table td {
    font-size: 13px;
}

.fingerprints-table tbody tr:hover {
    background-color: #f8f9fa;
}

.fingerprint-short {
    font-family: 'Courier New', monospace;
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.count-badge {
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.trace-id {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    background-color: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    margin: 1px;
}

.recent-traces {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.datetime {
    font-size: 11px;
    color: #666;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;  /* 限制最大高度为视窗高度的80% */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;  /* 使用flex布局 */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;  /* 头部不缩小 */
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 1.3rem;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;  /* 添加垂直滚动条 */
    flex: 1;  /* 占据剩余空间 */
}

.detail-item {
    margin-bottom: 15px;
}

.detail-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.detail-value {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    border: 1px solid #dee2e6;
    word-break: break-word;  /* 长单词自动换行 */
}

/* 堆栈跟踪特殊样式 */
.detail-value.stack-trace {
    white-space: pre-wrap;  /* 保留换行和空格 */
    font-size: 12px;
    max-height: 300px;  /* 限制最大高度 */
    overflow-y: auto;   /* 添加滚动条 */
    background-color: #2d3748;  /* 深色背景，像IDE */
    color: #e2e8f0;     /* 浅色文字 */
    border: 1px solid #4a5568;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-controls {
        justify-content: center;
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .simulation-controls {
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 85vh;  /* 移动设备上稍微增加高度 */
    }

    .container {
        padding: 10px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Status indicators */
.status-online {
    color: #28a745;
    font-weight: 600;
}

.status-offline {
    color: #dc3545;
    font-weight: 600;
}